//
//  CarBrandView.m
//  carcareIOS
//
//  Created by 王然 on 16/9/13.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "CarBrandView.h"

@implementation CarBrandView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
- (void)createUI
{

    
    CGFloat cityVW = 45;
    UIView * cityV = [[UIView viewWithFrame:CGRectMake(0, 0, cityVW, self.height)] setupOnView:self];
    cityV.backgroundColor = [UIColor clearColor];
    
    self.simpleCityL = [[UILabel labelWithFrame:CGRectMake(0, 0, 23, cityV.height) font:FONT_DEFAULT_Light(15) text:@"" textColor:[Theme mainNavColor]] setupOnView:cityV];
    
    UIImage * cityImage = ImageNamed(@"QueryChangeCityImage");
    self.cityImageV = [[UIImageView imageViewWithCenter:CGPointMake(self.simpleCityL.right + cityImage.size.width / 2, cityV.height / 2) image:cityImage] setupOnView:cityV];

    CGFloat brandTFW = self.width - cityVW;
    self.brandTF = [[UITextField textFieldWithFrame:CGRectMake(cityV.right, 0, brandTFW, self.height) textColor:Word_Color font:FONT_DEFAULT_Light(15)] setupOnView:self];
    self.brandTF.textAlignment = NSTextAlignmentLeft;
    self.brandTF.keyboardType = UIKeyboardTypeASCIICapable;
    self.brandTF.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
    self.brandTF.placeholder = @"请输入您的车牌号码";
    
    __weak __typeof(self) wself = self;
    [[UIButton buttonEmptyWithFrame:cityV.bounds click:^{
        if (wself.cityVClick) wself.cityVClick();
    }] setupOnView:cityV];
    
    CGFloat lineH = 0.5;
    [[[UIView viewWithFrame:CGRectMake(0, 0, self.width, lineH)] setupOnView:self] resetBackgroundColor:[Theme lineNewColor]];
    [[[UIView viewWithFrame:CGRectMake(0, self.height - lineH, self.width, lineH)] setupOnView:self] resetBackgroundColor:[Theme lineNewColor]];
}
@end
